<?php


namespace SidToken\Model;


use Think\Model;

class SidMinerModel extends Model
{
    const STATUS_ON = 1;
    const STATUS_DELETE = -1;
    const STATUS_OFF = 0;

    public function get($id, $field = null)
    {
        $data = $this->find($id);
        if ($data) {
            if ($field) {
                return $data[$field];
            } else {
                return $data;
            }
        } else {
            return null;
        }

    }

    public function updateSellAmount($id, $amount)
    {
        $this->where(['id' => $id])->setDec('left_amount', $amount);
    }
}